package com.zhengyisky.dao;

import com.zhengyisky.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.io.Serializable;

@Repository
public interface UserRepository extends JpaRepository<User, Serializable> {

    User findUserByOpenid(String baiduId);

    User findUserByPhoneAndPassword(String phone, String password);

    User findUserByPhone(String phone);

    @Query(value = "update tb_user set status=?2 where phone=?1",nativeQuery = true)
    @Modifying
    void updateStatusByPhone(String mobile, Integer status);

}
